import axios from '@/plugins/axios';
const BASE_API = import.meta.env.VITE_APP_BASE_APIURL as string;

import { CommonStore } from '@/store';
import { CommontTypes, ResponseVo } from '@/type';
import { StoreTypes } from '@/type/store';

export namespace StoreService {
  export const pageStore = async (data:Partial<StoreTypes.IStoreItem> & CommontTypes.IPaginationParam): Promise<ResponseVo<any>> => {
    let res:ResponseVo<any> = await axios.get('/store/page',{params:data, baseURL: BASE_API});
    return res;
  };

  export const addStore = async (data:StoreTypes.IStoreItem): Promise<ResponseVo<any>> => {
    let res:ResponseVo<any> = await axios.post('/store/add',data,{baseURL: BASE_API});
    return res;
  };

  export const editStore = async (data:StoreTypes.IStoreItem): Promise<ResponseVo<any>> => {
    let res:ResponseVo<any> = await axios.post('/store/edit',data,{baseURL: BASE_API});
    return res;
  };

  export const detailStore = async (storeCode:number): Promise<ResponseVo<any>> => {
    let res:ResponseVo<any> = await axios.get('/store/detail',{params:{storeCode}, baseURL: BASE_API});
    return res;
  };
}
